import request from '@/utils/httpRequest.js'

export function getDepartments () {
  return request({
    url: request.adornUrl('/sys/department/getDepartmentList'),
    method: 'post',
    data: request.adornData({page: 1, size: 1000})
  })
}

export function getDepartmentById (id) {
  return request({
    url: request.adornUrl(`/sys/department/getDepartmentById/${id}`),
    method: 'get'
  })
}

export function addDepartment (data) {
  return request({
    url: request.adornUrl('/sys/department/addDepartment'),
    method: 'post',
    data: request.adornData(data, false)
  })
}

export function updateDepartment (data) {
  return request({
    url: request.adornUrl('/sys/department/updateDepartment'),
    method: 'put',
    data: request.adornData(data, false)
  })
}

export function deleteDepartment (id) {
  return request({
    url: request.adornUrl(`/sys/department/deleteDepartmentById/${id}`),
    method: 'delete'
  })
}
